package com.vhall.component.controller.room;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vhall.component.controller.room.facade.RoomInnerFacade;
import com.vhall.component.entity.account.dto.IndexDto;
import com.vhall.component.entity.export.dto.AdminExportRoomQueryCondition;
import com.vhall.component.entity.inav.vo.*;
import com.vhall.component.entity.rebroadcast.vo.ListReqVo;
import com.vhall.component.entity.record.vo.RoomRspVO;
import com.vhall.component.entity.room.dto.RoomExtendsDTO;
import com.vhall.component.entity.room.dto.RoomJoinsEntityDTO;
import com.vhall.component.entity.room.dto.RoomWatermarkDTO;
import com.vhall.component.entity.room.dto.RoomsEntityDTO;
import com.vhall.component.entity.room.vo.*;
import com.vhall.component.framework.common.annotation.VhallComponent;
import com.vhall.component.service.room.RoomInnerService;
import com.vhall.component.service.room.RoomService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author guoxin.wang
 * @date 2021/7/12 17:30
 */
@Slf4j
@VhallComponent
@RequiredArgsConstructor
public class RoomInnerController implements RoomInnerFacade {


    private final RoomInnerService roomInnerService;

    private final RoomService roomService;

    @Override
    public RoomsEntityDTO getRoomInfo(String roomId) {
        return roomInnerService.getRoomInfo(roomId);
    }

    @Override
    public RoomsEntityDTO getRoomInfoByIlId(String ilId) {
        return roomInnerService.getRoomInfoByIlId(ilId);
    }

    @Override
    public RoomExtendsDTO getRoomExtendsByRoomId(String roomId) {
        return roomInnerService.getRoomExtendsByRoomId(roomId);
    }

    @Override
    public void checkRoomId(String roomId) {
        roomInnerService.checkRoomId(roomId);
    }

    @Override
    public List<RoomsEntityDTO> getRoomInfoByRoomIds(List<String> roomIds) {
        return roomInnerService.getRoomInfoByRoomIds(roomIds);
    }

    @Override
    public RoomJoinsEntityDTO getRoomJoinInfo(Integer accountId, String roomId) {
        return roomInnerService.getRoomJoinInfo(accountId, roomId);
    }


    @Override
    public Boolean setQuestionFlag(Integer joinId, Integer flag) {
        return roomInnerService.setQuestionFlag(joinId, flag);
    }

    @Override
    public Boolean setGiftFrequency(String roomId, Integer giftFrequency) {
        return roomInnerService.setGiftFrequency(roomId, giftFrequency);
    }

    @Override
    public List<RoomsEntityDTO> listOnlineChannel() {
        return roomInnerService.listOnlineChannel();
    }

    @Override
    public List<RoomsEntityDTO> listOnlineChannelOnAccount(Integer accountId) {
        return roomInnerService.listOnlineChannelOnAccount(accountId);
    }

    @Override
    public GetOnlineListRspVO getOnlineList(GetOnlineListReqVO reqVO) {
        return roomInnerService.getOnlineList(reqVO);
    }

    /**
     * 超级高频调用接口  主要用于系统里面大量得查询  room_jions表
     */
    @Override
    public RoomJoinsEntityDTO getRoomJoins(Integer accountId, String roomId) {
        return roomInnerService.getRoomJoins(accountId, roomId);
    }

    @Override
    public void updateRoomJoins(RoomJoinsEntityDTO roomJoinInfo, String type, String status) {
        roomInnerService.updateRoomJoins(roomJoinInfo, type, status);
    }

    @Override
    public void updateRoomJoinsById(RoomJoinsEntityDTO roomJoinInfo) {
        roomInnerService.updateRoomJoinsById(roomJoinInfo);
    }

    @Override
    public RoomJoinsEntityDTO getCurrentJoinUserByThirdId(String roomId, Integer thirdId) {
        return roomInnerService.getCurrentJoinUserByThirdId(roomId, thirdId);
    }


    @Override
    public Boolean batchBanned(String roomId, List<String> accountIdList, Integer status, Integer thirdPartyUserId) {
        List<Integer> accountIds = accountIdList.stream().map(Integer::parseInt).collect(Collectors.toList());
        return roomInnerService.batchBanned(roomId, accountIds, status, thirdPartyUserId);
    }

    @Override
    public Integer getBannedNum(String roomId) {
        return roomInnerService.getBannedNum(roomId);
    }

    @Override
    public Boolean batchKick(String roomId, List<String> accountIdList, Integer status, Integer thirdPartyUserId) {
        List<Integer> accountIds = accountIdList.stream().map(Integer::parseInt).collect(Collectors.toList());
        return roomInnerService.batchKick(roomId, accountIds, status, thirdPartyUserId);
    }

    @Override
    public BannedAndKickedListRspVO getBannedList(BannedKickedReqVO reqVO) {
        return roomInnerService.getBannedList(reqVO);
    }

    @Override
    public BannedKickedListRspVO getBannedList2(BannedKickedReqVO reqVO) {
        return roomInnerService.getBannedCacheList(reqVO);
    }

    @Override
    public BannedAndKickedListRspVO getKickedList(BannedKickedReqVO reqVO) {
        return roomInnerService.getKickedList(reqVO);
    }

    @Override
    public BannedKickedListRspVO getKickedList2(BannedKickedReqVO reqVO) {
        return roomInnerService.getKickedCacheList(reqVO);
    }

    @Override
    public BannedAndKickedListRspVO listBannedKicked(BannedKickedReqVO reqVO) {
        return roomInnerService.listBannedKicked(reqVO);
    }

    @Override
    public RoomJoinsEntityDTO queryRoomJoinsBySelectOne(QueryRoomJoinsBySelectOneReqVO reqVO) {
        return roomInnerService.queryRoomJoinsBySelectOne(reqVO);
    }

    @Override
    public UserListPage<GetUserListRspVO> getUserList(GetUserListReqVO reqVO) {
        return roomInnerService.getUserList(reqVO);
    }

    @Override
    public RoomSupplyEntityDTO getRoomSupplyByIlId(Integer ilId) {
        return roomInnerService.getRoomSupplyByIlId(ilId);
    }

    @Override
    public RoomJoinsEntityDTO updateOrInsertRoomJoin(RoomsEntityDTO room, String profilePhoto, Integer accountId, Integer roleName, String username, String nickname) {
        return roomInnerService.updateOrInsertRoomJoin(room, profilePhoto, accountId, roleName, username, nickname);
    }

    @Override
    public Integer updateLotteryWinner(RoomJoinsEntityDTO roomJoinsEntityDTO, String roomId, List<Integer> accountIds) {
        return roomInnerService.updateLotteryWinner(roomJoinsEntityDTO, roomId, accountIds);
    }


    @Override
    public void updateIsSignedByJoinId(String roomId, String thirdPartyUserId) {
        roomInnerService.updateIsSignedByJoinId(roomId, thirdPartyUserId);
    }

    @Override
    public int updateIsAnsweredVoteByJoinId(String roomId, String thirdPartyUserId) {
        return roomInnerService.updateIsAnsweredVoteByJoinId(roomId, thirdPartyUserId);
    }

    @Override
    public RoomJoinsEntityDTO getRoomJoinsByRoomIdAndThirdId(String roomId, Integer thirdPartyUserId) {
        return roomInnerService.getRoomJoinsByRoomIdAndThirdId(roomId, thirdPartyUserId);
    }


    @Override
    public RoomsEntityDTO getRoomsEntityInfo(String roomId) {
        return roomInnerService.getRoomsEntityInfo(roomId);
    }

    @Override
    public void updateLikeById(RoomsEntityDTO rooms) {
        roomInnerService.updateLikeById(rooms);
    }

    @Override
    public Integer getCountByIlidAndRecordId(String ilId, String recordId) {
        return roomInnerService.getCountByIlidAndRecordId(ilId, recordId);
    }

    @Override
    public Integer updateByIl(RoomsEntityDTO entity) {
        return roomInnerService.updateByIl(entity);
    }

    @Override
    public List<RoomRspVO> selectRoomList(List<Integer> ilIdlist) {
        return roomInnerService.selectRoomList(ilIdlist);
    }

    @Override
    public Map<Integer, RoomJoinsEntityDTO> getRoomInfoBySenderIds(String roomId, String senderIds) {
        return roomInnerService.getRoomInfoBySenderIds(roomId, senderIds);
    }

    @Override
    public List<RoomJoinsEntityDTO> getRoomInfoByAccountIds(String roomId, String accountIds) {
        return roomInnerService.getRoomInfoByAccountIds(roomId, accountIds);
    }

    @Override
    public RoomsEntityDTO getRoomInfoById(Integer ilId) {
        return roomInnerService.getRoomInfoById(ilId);
    }

    @Override
    public List<RoomsEntityDTO> getRoomsInfoByRoomIds(String roomIds) {
        return roomInnerService.getRoomsInfoByRoomIds(roomIds);
    }

    @Override
    public Map<String, Object> getRoomsEntityByRebroadcastList(ListReqVo reqVo) {
        return roomInnerService.getRoomsEntityByRebroadcastList(reqVo);
    }

    @Override
    public List<RoomJoinsEntityDTO> getRoomJoinsList(QueryRoomJoinsReqVO reqVO) {
        return roomInnerService.getRoomJoinsList(reqVO);
    }

    @Override
    public RoomJoinsEntityDTO getHostUserInfoByRoomId(String roomId) {
        return roomInnerService.getHostUserInfoByRoomId(roomId);
    }

    @Override
    public IndexDto getCount(String beginTime) {
        return roomInnerService.getCount(beginTime);
    }

    @Override
    public Integer sumMessageTotalByAccountId(Integer ilId, LocalDateTime beginTime, LocalDateTime endTime) {
        return roomInnerService.sumMessageTotal(ilId, beginTime, endTime);
    }

    @Override
    public int countRoomForAdminExport(AdminExportRoomQueryCondition condition) {
        return roomInnerService.countRoomForAdminExport(condition);
    }

    @Override
    public Map<String, Object> getRoomWarmInfo(Integer ilId) {
        return roomInnerService.getRoomWarmInfo(ilId);
    }

    @Override
    public RoomSupplyEntityDTO getRoomSupplyByRoomId(String roomId) {
        return roomInnerService.getRoomSupplyByRoomId(roomId);
    }

    @Override
    public void updateConfigValueByRoomId(String roomId, Integer status, String type) {
        roomInnerService.updateConfigValueByRoomId(roomId, status, type);
    }

    @Override
    public void insertOrUpdateRoomConfigByAccountId(Integer accountId, Integer status, String type) {
        roomInnerService.insertOrUpdateRoomConfigByAccountId(accountId, status, type);
    }

    @Override
    public Page<RoomsEntityVO> getRoomsListByAccountId(RoomInnerListVO roomInnerListVO) {
        return roomInnerService.getRoomsListByAccountId(roomInnerListVO);
    }

    @Override
    public String getDefaultWatermarkTemplateId() {
        return roomInnerService.getDefaultWatermarkTemplateId();
    }

    @Override
    public void setDefaultWatermarkTemplateId(Integer watermarkTemplateId) {
        roomInnerService.setDefaultWatermarkTemplateId(watermarkTemplateId);
    }

    @Override
    public void clearRoomWatermark(String tempId) {
        roomInnerService.clearRoomWatermark(tempId);

    }

    @Override
    public RoomWatermarkDTO getRoomWatermark(Integer watermarkTempId) {
        return roomService.getRoomWatermark(watermarkTempId);
    }

}
